GError **error)
{
gboolean ret = FALSE;
- gs_free char *contents = NULL;
+ g_autofree char *contents = NULL;
char **lines = NULL;
char **iter = NULL;
{
GFileInfo *file_info;
const char *fname;
- gs_free char *subdir_grub_cfg = NULL;
+ g_autofree char *subdir_grub_cfg = NULL;
if (!gs_file_enumerator_iterate (direnum, &file_info, NULL,
cancellable, error))
gs_unref_object GSSubprocessContext *procctx = NULL;
gs_unref_object GSSubprocess *proc = NULL;
gs_strfreev char **child_env = g_get_environ ();
- gs_free char *bootversion_str = g_strdup_printf ("%u", (guint)bootversion);
+ g_autofree char *bootversion_str = g_strdup_printf ("%u", (guint)bootversion);
gs_unref_object GFile *config_path_efi_dir = NULL;
- gs_free char *grub2_mkconfig_chroot = NULL;
+ g_autofree char *grub2_mkconfig_chroot = NULL;
if (ostree_sysroot_get_booted_deployment (self->sysroot) == NULL
&& g_file_has_parent (self->sysroot->path, NULL))
gboolean ret = FALSE;
OstreeBootloaderSyslinux *self = OSTREE_BOOTLOADER_SYSLINUX (bootloader);
gs_unref_object GFile *new_config_path = NULL;
- gs_free char *config_contents = NULL;
- gs_free char *new_config_contents = NULL;
+ g_autofree char *config_contents = NULL;
+ g_autofree char *new_config_contents = NULL;
gs_unref_ptrarray GPtrArray *new_lines = NULL;
gs_unref_ptrarray GPtrArray *tmp_lines = NULL;
- gs_free char *kernel_arg = NULL;
+ g_autofree char *kernel_arg = NULL;
gboolean saw_default = FALSE;
gboolean regenerate_default = FALSE;
gboolean parsing_label = FALSE;
{
OstreeBootloaderUboot *self = OSTREE_BOOTLOADER_UBOOT (bootloader);
gs_unref_object GFile *new_config_path = NULL;
- gs_free char *config_contents = NULL;
- gs_free char *new_config_contents = NULL;
+ g_autofree char *config_contents = NULL;
+ g_autofree char *new_config_contents = NULL;
gs_unref_ptrarray GPtrArray *new_lines = NULL;
/* This should follow the symbolic link to the current bootversion. */
{
gboolean ret = FALSE;
GMatchInfo *match = NULL;
- gs_free char *remote = NULL;
+ g_autofree char *remote = NULL;
static gsize regex_initialized;
static GRegex *regex;
gs_unref_object GFileInfo *ret_file_info = NULL;
gs_unref_variant GVariant *ret_xattrs = NULL;
gs_unref_variant GVariant *file_header = NULL;
- gs_free guchar *buf = NULL;
+ g_autofree guchar *buf = NULL;
if (!g_input_stream_read_all (input,
&archive_header_size, 4, &bytes_read,
GError **error)
{
gboolean ret = FALSE;
- gs_free guchar *ret_csum = NULL;
+ g_autofree guchar *ret_csum = NULL;
GChecksum *checksum = NULL;
checksum = g_checksum_new (G_CHECKSUM_SHA256);
gs_unref_object GFileInfo *file_info = NULL;
gs_unref_object GInputStream *in = NULL;
gs_unref_variant GVariant *xattrs = NULL;
- gs_free guchar *ret_csum = NULL;
+ g_autofree guchar *ret_csum = NULL;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
GError **error)
{
gboolean ret = FALSE;
- gs_free char *tmpname = NULL;
+ g_autofree char *tmpname = NULL;
guint i;
const int max_attempts = 128;
const char *to,
guint i)
{
- gs_free char *partstr = g_strdup_printf ("%u", i);
+ g_autofree char *partstr = g_strdup_printf ("%u", i);
return _ostree_get_relative_static_delta_path (from, to, partstr);
}
if (self->origin)
{
- gs_free char *data = NULL;
+ g_autofree char *data = NULL;
gsize len;
gboolean success;
GError **error)
{
gboolean ret = FALSE;
- gs_free char *ret_checksum = NULL;
- gs_free guchar *csum = NULL;
+ g_autofree char *ret_checksum = NULL;
+ g_autofree guchar *csum = NULL;
if (OSTREE_IS_REPO_FILE (f))
{
GError **error)
{
gboolean ret = FALSE;
- gs_free char *checksum_a = NULL;
- gs_free char *checksum_b = NULL;
+ g_autofree char *checksum_a = NULL;
+ g_autofree char *checksum_b = NULL;
OstreeDiffItem *ret_item = NULL;
if (!get_file_checksum (flags, a, a_info, &checksum_a, cancellable, error))
{
if (g_file_is_native (file))
{
- gs_free char *relpath = g_file_get_relative_path (base, file);
+ g_autofree char *relpath = g_file_get_relative_path (base, file);
g_print ("%c %s\n", prefix, relpath);
}
else
if (bytes_read > pending->max_size ||
(bytes_read + pending->current_size) > pending->max_size)
{
- gs_free char *uristr = soup_uri_to_string (pending->uri, FALSE);
+ g_autofree char *uristr = soup_uri_to_string (pending->uri, FALSE);
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"URI %s exceeded maximum size of %" G_GUINT64_FORMAT " bytes",
uristr,
}
else
{
- gs_free char *uristring = soup_uri_to_string (uri, FALSE);
- gs_free char *tmpfile = NULL;
+ g_autofree char *uristring = soup_uri_to_string (uri, FALSE);
+ g_autofree char *tmpfile = NULL;
struct stat stbuf;
gboolean exists;
{
gboolean ret = FALSE;
const guint8 nulchar = 0;
- gs_free char *ret_contents = NULL;
+ g_autofree char *ret_contents = NULL;
gs_unref_object GMemoryOutputStream *buf = NULL;
FetchUriSyncData data;
g_assert (error != NULL);
const gchar *key_id,
guint *out_signature_index)
{
- gs_free char *key_id_upper = NULL;
+ g_autofree char *key_id_upper = NULL;
gpgme_signature_t signature;
guint signature_index;
gboolean ret = FALSE;
GError **error)
{
gs_unref_object GFile *proc_cmdline_path = g_file_new_for_path ("/proc/cmdline");
- gs_free char *proc_cmdline = NULL;
+ g_autofree char *proc_cmdline = NULL;
gsize proc_cmdline_len = 0;
gs_strfreev char **proc_cmdline_args = NULL;
break;
case OSTREE_METALINK_STATE_SIZE:
{
- gs_free char *duped = g_strndup (text, text_len);
+ g_autofree char *duped = g_strndup (text, text_len);
self->size = g_ascii_strtoull (duped, NULL, 10);
}
break;
break;
case OSTREE_METALINK_STATE_URL:
{
- gs_free char *uri_text = g_strndup (text, text_len);
+ g_autofree char *uri_text = g_strndup (text, text_len);
SoupURI *uri = soup_uri_new (uri_text);
if (uri != NULL)
g_ptr_array_add (self->urls, uri);
struct stat stbuf;
int parent_dfd = _ostree_fetcher_get_dfd (self->metalink->fetcher);
gs_unref_object GInputStream *instream = NULL;
- gs_free char *result = NULL;
+ g_autofree char *result = NULL;
GChecksum *checksum = NULL;
result = _ostree_fetcher_request_uri_with_partial_finish ((OstreeFetcher*)src, res, &local_error);
{
gboolean ret = FALSE;
gs_unref_object OstreeMutableTree *ret_subdir = NULL;
- gs_free char *ret_file_checksum = NULL;
+ g_autofree char *ret_file_checksum = NULL;
ret_subdir = ot_gobject_refz (g_hash_table_lookup (self->subdirs, name));
if (!ret_subdir)
GError **error)
{
gboolean ret = FALSE;
- gs_free char *temp_filename = NULL;
+ g_autofree char *temp_filename = NULL;
gs_unref_object GOutputStream *temp_out = NULL;
int fd;
int res;
GError **error)
{
gboolean ret = FALSE;
- gs_free char *temp_filename = NULL;
+ g_autofree char *temp_filename = NULL;
if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_SYMBOLIC_LINK)
{
{
gs_unref_object GFile *objdir = NULL;
gs_unref_object GFileEnumerator *enumerator = NULL;
- gs_free char *objdir_name = NULL;
+ g_autofree char *objdir_name = NULL;
objdir_name = g_strdup_printf ("%02x", GPOINTER_TO_UINT (key));
objdir = g_file_get_child (self->uncompressed_objects_dir, objdir_name);
GError **error)
{
gboolean ret = FALSE;
- gs_free char *temp_filename = NULL;
+ g_autofree char *temp_filename = NULL;
gs_unref_object GOutputStream *ret_stream = NULL;
gboolean have_obj;
char loose_objpath[_OSTREE_LOOSE_PATH_MAX];
const char *actual_checksum;
gboolean do_commit;
OstreeRepoMode repo_mode;
- gs_free char *temp_filename = NULL;
+ g_autofree char *temp_filename = NULL;
gs_unref_object GFile *stored_path = NULL;
- gs_free guchar *ret_csum = NULL;
+ g_autofree guchar *ret_csum = NULL;
gs_unref_object OstreeChecksumInputStream *checksum_input = NULL;
gs_unref_object GInputStream *file_input = NULL;
gs_unref_object GFileInfo *file_info = NULL;
{
if (G_UNLIKELY (file_object_length > OSTREE_MAX_METADATA_WARN_SIZE))
{
- gs_free char *metasize = g_format_size (file_object_length);
- gs_free char *warnsize = g_format_size (OSTREE_MAX_METADATA_WARN_SIZE);
- gs_free char *maxsize = g_format_size (OSTREE_MAX_METADATA_SIZE);
+ g_autofree char *metasize = g_format_size (file_object_length);
+ g_autofree char *warnsize = g_format_size (OSTREE_MAX_METADATA_WARN_SIZE);
+ g_autofree char *maxsize = g_format_size (OSTREE_MAX_METADATA_SIZE);
g_warning ("metadata object %s is %s, which is larger than the warning threshold of %s." \
" The hard limit on metadata size is %s. Put large content in the tree itself, not in metadata.",
actual_checksum,
if (G_UNLIKELY (g_variant_get_size (normalized) > OSTREE_MAX_METADATA_SIZE))
{
- gs_free char *input_bytes = g_format_size (g_variant_get_size (normalized));
- gs_free char *max_bytes = g_format_size (OSTREE_MAX_METADATA_SIZE);
+ g_autofree char *input_bytes = g_format_size (g_variant_get_size (normalized));
+ g_autofree char *max_bytes = g_format_size (OSTREE_MAX_METADATA_SIZE);
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Metadata object of type '%s' is %s; maximum metadata size is %s",
ostree_object_type_to_string (objtype),
GError **error)
{
gboolean ret = FALSE;
- gs_free char *ret_commit = NULL;
+ g_autofree char *ret_commit = NULL;
gs_unref_variant GVariant *commit = NULL;
gs_unref_variant GVariant *new_metadata = NULL;
- gs_free guchar *commit_csum = NULL;
+ g_autofree guchar *commit_csum = NULL;
GDateTime *now = NULL;
OstreeRepoFile *repo_root = OSTREE_REPO_FILE (root);
if (modifier && modifier->sepolicy)
{
- gs_free char *label = NULL;
+ g_autofree char *label = NULL;
if (!ostree_sepolicy_get_label (modifier->sepolicy, relpath,
g_file_info_get_attribute_uint32 (file_info, "unix::mode"),
gs_unref_object GFile *child = NULL;
gs_unref_object GFileInfo *modified_info = NULL;
gs_unref_object OstreeMutableTree *child_mtree = NULL;
- gs_free char *child_relpath = NULL;
+ g_autofree char *child_relpath = NULL;
const char *name;
GFileType file_type;
OstreeRepoCommitFilterResult filter_result;
gs_unref_object GInputStream *file_input = NULL;
gs_unref_variant GVariant *xattrs = NULL;
gs_unref_object GInputStream *file_object_input = NULL;
- gs_free guchar *child_file_csum = NULL;
- gs_free char *tmp_checksum = NULL;
+ g_autofree guchar *child_file_csum = NULL;
+ g_autofree char *tmp_checksum = NULL;
loose_checksum = devino_cache_lookup (self,
g_file_info_get_attribute_uint32 (child_info, "unix::device"),
{
gs_unref_object GFileInfo *modified_info = NULL;
gs_unref_variant GVariant *xattrs = NULL;
- gs_free guchar *child_file_csum = NULL;
- gs_free char *tmp_checksum = NULL;
- gs_free char *relpath = NULL;
+ g_autofree guchar *child_file_csum = NULL;
+ g_autofree char *tmp_checksum = NULL;
+ g_autofree char *relpath = NULL;
child_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
gs_unref_object GFileInfo *child_info = NULL;
gs_unref_object GFileInfo *modified_info = NULL;
gs_unref_variant GVariant *xattrs = NULL;
- gs_free guchar *child_file_csum = NULL;
- gs_free char *tmp_checksum = NULL;
- gs_free char *relpath = NULL;
+ g_autofree guchar *child_file_csum = NULL;
+ g_autofree char *tmp_checksum = NULL;
+ g_autofree char *relpath = NULL;
OstreeRepoCommitFilterResult filter_result;
struct stat dir_stbuf;
gs_unref_hashtable GHashTable *dir_metadata_checksums = NULL;
gs_unref_hashtable GHashTable *dir_contents_checksums = NULL;
gs_unref_variant GVariant *serialized_tree = NULL;
- gs_free guchar *contents_csum = NULL;
+ g_autofree guchar *contents_csum = NULL;
char contents_checksum_buf[65];
dir_contents_checksums = g_hash_table_new_full (g_str_hash, g_str_equal,
gs_unref_variant GVariant *tree_metadata = NULL;
gs_unref_variant GVariant *contents_csum_v = NULL;
gs_unref_variant GVariant *metadata_csum_v = NULL;
- gs_free char *tmp_checksum = NULL;
+ g_autofree char *tmp_checksum = NULL;
if (!ostree_repo_file_ensure_resolved (self->parent, error))
goto out;
gs_unref_object OstreeMutableTree *subdir = NULL;
gs_unref_object OstreeMutableTree *parent = NULL;
gs_unref_object OstreeMutableTree *hardlink_source_parent = NULL;
- gs_free char *hardlink_source_checksum = NULL;
+ g_autofree char *hardlink_source_checksum = NULL;
gs_unref_object OstreeMutableTree *hardlink_source_subdir = NULL;
- gs_free guchar *tmp_csum = NULL;
- gs_free char *tmp_checksum = NULL;
+ g_autofree guchar *tmp_csum = NULL;
+ g_autofree char *tmp_checksum = NULL;
pathname = archive_entry_pathname (entry);
struct archive_entry *entry;
int r;
gs_unref_object GFileInfo *tmp_dir_info = NULL;
- gs_free guchar *tmp_csum = NULL;
+ g_autofree guchar *tmp_csum = NULL;
a = archive_read_new ();
#ifdef HAVE_ARCHIVE_READ_SUPPORT_FILTER_ALL
const char *dash = strchr (deltaname, '-');
const char *to = NULL;
gboolean have_commit;
- gs_free char *from = NULL;
- gs_free char *deltadir = NULL;
+ g_autofree char *from = NULL;
+ g_autofree char *deltadir = NULL;
if (!dash)
{
if (pull_data->fetching_sync_uri)
{
- gs_free char *uri_string = soup_uri_to_string (pull_data->fetching_sync_uri, TRUE);
- gs_free char *status_string = g_strconcat ("Requesting ", uri_string, NULL);
+ g_autofree char *uri_string = soup_uri_to_string (pull_data->fetching_sync_uri, TRUE);
+ g_autofree char *status_string = g_strconcat ("Requesting ", uri_string, NULL);
ostree_async_progress_set_status (pull_data->progress, status_string);
}
else
{
gboolean ret = FALSE;
gs_unref_bytes GBytes *bytes = NULL;
- gs_free char *ret_contents = NULL;
+ g_autofree char *ret_contents = NULL;
gsize len;
if (!fetch_uri_contents_membuf_sync (pull_data, uri, TRUE, FALSE,
const char *filename;
gboolean file_is_stored;
gs_unref_variant GVariant *csum = NULL;
- gs_free char *file_checksum = NULL;
+ g_autofree char *file_checksum = NULL;
g_variant_get_child (files_variant, i, "(&s@ay)", &filename, &csum);
{
const char *subpath = NULL;
const char *nextslash = NULL;
- gs_free char *dir_data = NULL;
+ g_autofree char *dir_data = NULL;
g_assert (pull_data->dir[0] == '/'); // assert it starts with / like "/usr/share/rpm"
subpath = pull_data->dir + 1; // refers to name minus / like "usr/share/rpm"
GError **error)
{
gboolean ret = FALSE;
- gs_free char *ret_contents = NULL;
+ g_autofree char *ret_contents = NULL;
SoupURI *target_uri = NULL;
target_uri = suburi_new (pull_data->base_uri, "refs", "heads", ref, NULL);
GError **error = &local_error;
OstreeObjectType objtype;
const char *expected_checksum;
- gs_free guchar *csum = NULL;
- gs_free char *checksum = NULL;
+ g_autofree guchar *csum = NULL;
+ g_autofree char *checksum = NULL;
if (!ostree_repo_write_content_finish ((OstreeRepo*)object, result,
&csum, error))
gs_unref_variant GVariant *xattrs = NULL;
gs_unref_object GInputStream *file_in = NULL;
gs_unref_object GInputStream *object_input = NULL;
- gs_free char *temp_path = NULL;
+ g_autofree char *temp_path = NULL;
const char *checksum;
OstreeObjectType objtype;
GError **error = &local_error;
const char *expected_checksum;
OstreeObjectType objtype;
- gs_free char *checksum = NULL;
- gs_free guchar *csum = NULL;
- gs_free char *stringified_object = NULL;
+ g_autofree char *checksum = NULL;
+ g_autofree guchar *csum = NULL;
+ g_autofree char *stringified_object = NULL;
if (!ostree_repo_write_metadata_finish ((OstreeRepo*)object, result,
&csum, error))
FetchObjectData *fetch_data = user_data;
OtPullData *pull_data = fetch_data->pull_data;
gs_unref_variant GVariant *metadata = NULL;
- gs_free char *temp_path = NULL;
+ g_autofree char *temp_path = NULL;
const char *checksum;
OstreeObjectType objtype;
GError *local_error = NULL;
FetchStaticDeltaData *fetch_data = user_data;
OtPullData *pull_data = fetch_data->pull_data;
gs_unref_variant GVariant *metadata = NULL;
- gs_free char *temp_path = NULL;
+ g_autofree char *temp_path = NULL;
gs_unref_object GInputStream *in = NULL;
- gs_free char *actual_checksum = NULL;
- gs_free guint8 *csum = NULL;
+ g_autofree char *actual_checksum = NULL;
+ g_autofree guint8 *csum = NULL;
GError *local_error = NULL;
GError **error = &local_error;
gs_fd_close int fd = -1;
{
gboolean ret = FALSE;
gs_unref_variant GVariant *object = NULL;
- gs_free char *tmp_checksum = NULL;
+ g_autofree char *tmp_checksum = NULL;
gboolean is_requested;
gboolean is_stored;
SoupURI *obj_uri = NULL;
gboolean is_meta;
FetchObjectData *fetch_data;
- gs_free char *objpath = NULL;
+ g_autofree char *objpath = NULL;
guint64 *expected_max_size_p;
guint64 expected_max_size;
GError **error)
{
OstreeRepo *parent = ostree_repo_get_parent (self);
- gs_free char *value = NULL;
+ g_autofree char *value = NULL;
gboolean ret = FALSE;
if (!_ostree_repo_get_remote_option (self, remote_name, option_name, NULL, &value, error))
GError **error)
{
gboolean ret = FALSE;
- gs_free char *contents = NULL;
+ g_autofree char *contents = NULL;
GKeyFile *ret_keyfile = NULL;
SoupURI *target_uri = NULL;
GError **error)
{
gboolean ret = FALSE;
- gs_free char *meta_path = _ostree_get_relative_static_delta_detachedmeta_path (from_revision, checksum);
+ g_autofree char *meta_path = _ostree_get_relative_static_delta_detachedmeta_path (from_revision, checksum);
gs_unref_bytes GBytes *detached_meta_data = NULL;
SoupURI *target_uri = NULL;
gs_unref_variant GVariant *metadata = NULL;
{
gboolean ret = FALSE;
gs_unref_variant GVariant *ret_delta_superblock = NULL;
- gs_free char *delta_name =
+ g_autofree char *delta_name =
_ostree_get_relative_static_delta_superblock_path (from_revision, to_revision);
gs_unref_bytes GBytes *delta_superblock_data = NULL;
gs_unref_bytes GBytes *delta_meta_data = NULL;
{
gboolean ret = FALSE;
gs_unref_variant GVariant *csum_v = NULL;
- gs_free char *checksum = NULL;
+ g_autofree char *checksum = NULL;
guint8 objtype_y;
OstreeObjectType objtype;
gboolean is_stored;
/* Write the to-commit object */
{
gs_unref_variant GVariant *to_csum_v = NULL;
- gs_free char *to_checksum = NULL;
+ g_autofree char *to_checksum = NULL;
gs_unref_variant GVariant *to_commit = NULL;
gboolean have_to_commit;
gs_unref_variant GVariant *header = NULL;
gboolean have_all = FALSE;
SoupURI *target_uri = NULL;
- gs_free char *deltapart_path = NULL;
+ g_autofree char *deltapart_path = NULL;
FetchStaticDeltaData *fetch_data;
gs_unref_variant GVariant *csum_v = NULL;
gs_unref_variant GVariant *objects = NULL;
gpointer key, value;
gboolean tls_permissive = FALSE;
OstreeFetcherConfigFlags fetcher_flags = 0;
- gs_free char *remote_key = NULL;
- gs_free char *path = NULL;
- gs_free char *baseurl = NULL;
- gs_free char *metalink_url_str = NULL;
+ g_autofree char *remote_key = NULL;
+ g_autofree char *path = NULL;
+ g_autofree char *baseurl = NULL;
+ g_autofree char *metalink_url_str = NULL;
gs_unref_hashtable GHashTable *requested_refs_to_fetch = NULL;
gs_unref_hashtable GHashTable *commits_to_fetch = NULL;
- gs_free char *remote_mode_str = NULL;
+ g_autofree char *remote_mode_str = NULL;
gs_unref_object OstreeMetalink *metalink = NULL;
OtPullData pull_data_real = { 0, };
OtPullData *pull_data = &pull_data_real;
commits_to_fetch = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
{
- gs_free char *tls_client_cert_path = NULL;
- gs_free char *tls_client_key_path = NULL;
+ g_autofree char *tls_client_cert_path = NULL;
+ g_autofree char *tls_client_key_path = NULL;
if (!_ostree_repo_get_remote_option (self,
remote_name_or_baseurl, "tls-client-cert-path",
}
{
- gs_free char *tls_ca_path = NULL;
+ g_autofree char *tls_ca_path = NULL;
gs_unref_object GTlsDatabase *db = NULL;
if (!_ostree_repo_get_remote_option (self,
}
{
- gs_free char *http_proxy = NULL;
+ g_autofree char *http_proxy = NULL;
if (!_ostree_repo_get_remote_option (self,
remote_name_or_baseurl, "proxy",
}
else
{
- gs_free char *metalink_data = NULL;
+ g_autofree char *metalink_data = NULL;
SoupURI *metalink_uri = soup_uri_new (metalink_url_str);
SoupURI *target_uri = NULL;
gs_fd_close int fd = -1;
goto out;
{
- gs_free char *repo_base = g_path_get_dirname (soup_uri_get_path (target_uri));
+ g_autofree char *repo_base = g_path_get_dirname (soup_uri_get_path (target_uri));
pull_data->base_uri = soup_uri_copy (target_uri);
soup_uri_set_path (pull_data->base_uri, repo_base);
}
{
SoupURI *summary_uri = NULL;
gs_unref_bytes GBytes *bytes = NULL;
- gs_free char *ret_contents = NULL;
+ g_autofree char *ret_contents = NULL;
summary_uri = suburi_new (pull_data->base_uri, "summary", NULL);
if (!fetch_uri_contents_membuf_sync (pull_data, summary_uri, FALSE, TRUE,
g_hash_table_iter_init (&hash_iter, requested_refs_to_fetch);
while (g_hash_table_iter_next (&hash_iter, &key, &value))
{
- gs_free char *from_revision = NULL;
+ g_autofree char *from_revision = NULL;
const char *ref = key;
const char *to_revision = value;
GVariant *delta_superblock = NULL;
{
const char *ref = key;
const char *checksum = value;
- gs_free char *remote_ref = NULL;
- gs_free char *original_rev = NULL;
+ g_autofree char *remote_ref = NULL;
+ g_autofree char *original_rev = NULL;
if (pull_data->remote_name)
remote_ref = g_strdup_printf ("%s/%s", pull_data->remote_name, ref);
GError **error)
{
gboolean ret = FALSE;
- gs_free char *ret_rev = NULL;
+ g_autofree char *ret_rev = NULL;
if (self->parent_repo)
{
gboolean ret = FALSE;
__attribute__((unused)) GCancellable *cancellable = NULL;
GError *temp_error = NULL;
- gs_free char *ret_rev = NULL;
+ g_autofree char *ret_rev = NULL;
gs_unref_object GFile *child = NULL;
g_return_val_if_fail (ref != NULL, FALSE);
static const char hexchars[] = "0123456789abcdef";
gsize off;
gs_unref_hashtable GHashTable *ref_list = NULL;
- gs_free char *ret_rev = NULL;
+ g_autofree char *ret_rev = NULL;
guint length;
const char *checksum = NULL;
OstreeObjectType objtype;
GError **error)
{
gboolean ret = FALSE;
- gs_free char *ret_rev = NULL;
+ g_autofree char *ret_rev = NULL;
g_return_val_if_fail (refspec != NULL, FALSE);
if (g_str_has_suffix (refspec, "^"))
{
- gs_free char *parent_refspec = NULL;
- gs_free char *parent_rev = NULL;
+ g_autofree char *parent_refspec = NULL;
+ g_autofree char *parent_rev = NULL;
gs_unref_variant GVariant *commit = NULL;
parent_refspec = g_strdup (refspec);
}
else
{
- gs_free char *remote = NULL;
- gs_free char *ref = NULL;
+ g_autofree char *remote = NULL;
+ g_autofree char *ref = NULL;
if (!ostree_parse_refspec (refspec, &remote, &ref, error))
goto out;
{
gboolean ret = FALSE;
gs_unref_hashtable GHashTable *ret_all_refs = NULL;
- gs_free char *remote = NULL;
- gs_free char *ref_prefix = NULL;
+ g_autofree char *remote = NULL;
+ g_autofree char *ref_prefix = NULL;
ret_all_refs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
{
const char *refspec = key;
const char *rev = value;
- gs_free char *remote = NULL;
- gs_free char *ref = NULL;
+ g_autofree char *remote = NULL;
+ g_autofree char *ref = NULL;
if (!ostree_parse_refspec (refspec, &remote, &ref, error))
goto out;
GError **error)
{
gboolean ret = FALSE;
- gs_free char *tmpname = g_strdup ("tmpostree-deltaobj-XXXXXX");
+ g_autofree char *tmpname = g_strdup ("tmpostree-deltaobj-XXXXXX");
gs_fd_close int fd = -1;
gs_unref_bytes GBytes *ret_content = NULL;
gs_unref_object GInputStream *istream = NULL;
if (fallback)
{
- gs_free char *size = g_format_size (uncompressed_size);
+ g_autofree char *size = g_format_size (uncompressed_size);
if (opts & DELTAOPT_FLAG_VERBOSE)
g_printerr ("fallback for %s (%s)\n", checksum, size);
gs_unref_ptrarray GPtrArray *part_tempfiles = NULL;
gs_unref_variant GVariant *delta_descriptor = NULL;
gs_unref_variant GVariant *to_commit = NULL;
- gs_free char *descriptor_relpath = NULL;
+ g_autofree char *descriptor_relpath = NULL;
gs_unref_object GFile *descriptor_path = NULL;
gs_unref_object GFile *descriptor_dir = NULL;
gs_unref_variant GVariant *tmp_metadata = NULL;
OstreeStaticDeltaPartBuilder *part_builder = builder.parts->pdata[i];
GBytes *payload_b;
GBytes *operations_b;
- gs_free guchar *part_checksum = NULL;
+ g_autofree guchar *part_checksum = NULL;
gs_free_checksum GChecksum *checksum = NULL;
gs_unref_bytes GBytes *objtype_checksum_array = NULL;
gs_unref_bytes GBytes *checksum_bytes = NULL;
for (i = 0; i < builder.parts->len; i++)
{
GFile *tempfile = part_tempfiles->pdata[i];
- gs_free char *part_relpath = _ostree_get_relative_static_delta_part_path (from, to, i);
+ g_autofree char *part_relpath = _ostree_get_relative_static_delta_part_path (from, to, i);
gs_unref_object GFile *part_path = g_file_resolve_relative_path (self->repodir, part_relpath);
if (!gs_file_rename (tempfile, part_path, cancellable, error))
if (g_file_query_exists (meta_path, NULL))
{
- gs_free char *buf = g_strconcat (name1, name2, NULL);
+ g_autofree char *buf = g_strconcat (name1, name2, NULL);
GString *out = g_string_new ("");
char checksum[65];
guchar csum[32];
/* Write the to-commit object */
{
gs_unref_variant GVariant *to_csum_v = NULL;
- gs_free char *to_checksum = NULL;
+ g_autofree char *to_checksum = NULL;
gs_unref_variant GVariant *to_commit = NULL;
gboolean have_to_commit;
if (!skip_validation)
{
- gs_free char *expected_checksum = ostree_checksum_from_bytes (csum);
+ g_autofree char *expected_checksum = ostree_checksum_from_bytes (csum);
if (!_ostree_static_delta_part_validate (self, part_path, i,
expected_checksum,
cancellable, error))
{
gboolean ret = FALSE;
gs_unref_object GInputStream *tmp_in = NULL;
- gs_free guchar *actual_checksum_bytes = NULL;
- gs_free gchar *actual_checksum = NULL;
+ g_autofree guchar *actual_checksum_bytes = NULL;
+ g_autofree char *actual_checksum = NULL;
tmp_in = (GInputStream*)g_file_read (part_path, cancellable, error);
if (!tmp_in)
guint64 offset, length;
gs_unref_object GInputStream *in_stream = NULL;
g_autoptr(GMappedFile) input_mfile = NULL;
- gs_free guchar *buf = NULL;
+ g_autofree guchar *buf = NULL;
struct bspatch_stream stream;
struct bzpatch_opaque_s opaque;
gsize bytes_written;
if (S_ISLNK (state->mode))
{
- gs_free char *nulterminated_target =
+ g_autofree char *nulterminated_target =
g_strndup ((char*)state->payload_data + content_offset, state->content_size);
g_file_info_set_symlink_target (finfo, nulterminated_target);
}
GError **error)
{
gboolean ret = FALSE;
- gs_free char *tmp_checksum = NULL;
+ g_autofree char *tmp_checksum = NULL;
while (TRUE)
{
GError **error)
{
gboolean ret = FALSE;
- gs_free char *data = NULL;
+ g_autofree char *data = NULL;
gsize len;
g_return_val_if_fail (self->inited, FALSE);
if (sysroot != NULL || ostree_repo_is_system (self))
{
const char *sysconf_remotes = SYSCONFDIR "/ostree/remotes.d";
- gs_free char *basename = g_strconcat (name, ".conf", NULL);
+ g_autofree char *basename = g_strconcat (name, ".conf", NULL);
gs_unref_object GFile *etc_ostree_remotes_d = NULL;
if (sysroot == NULL)
if (remote->file != NULL)
{
- gs_free char *data = NULL;
+ g_autofree char *data = NULL;
gsize length;
data = g_key_file_to_data (remote->options, &length, NULL);
GError **error)
{
local_cleanup_remote OstreeRemote *remote = NULL;
- gs_free char *url = NULL;
+ g_autofree char *url = NULL;
gboolean ret = FALSE;
g_return_val_if_fail (name != NULL, FALSE);
gboolean ret = FALSE;
gboolean is_archive;
struct stat stbuf;
- gs_free char *version = NULL;
- gs_free char *mode = NULL;
- gs_free char *parent_repo_path = NULL;
+ g_autofree char *version = NULL;
+ g_autofree char *mode = NULL;
+ g_autofree char *parent_repo_path = NULL;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
{
gboolean ret = FALSE;
gs_unref_object GFile *ret_root = NULL;
- gs_free char *resolved_commit = NULL;
+ g_autofree char *resolved_commit = NULL;
if (!ostree_repo_resolve_rev (self, ref, FALSE, &resolved_commit, error))
goto out;
{
GSConsole *console = user_data;
GString *buf;
- gs_free char *status = NULL;
+ g_autofree char *status = NULL;
guint outstanding_fetches;
guint outstanding_metadata_fetches;
guint outstanding_writes;
guint metadata_fetched = ostree_async_progress_get_uint (progress, "metadata-fetched");
guint requested = ostree_async_progress_get_uint (progress, "requested");
guint64 bytes_sec = (g_get_monotonic_time () - ostree_async_progress_get_uint64 (progress, "start-time")) / G_USEC_PER_SEC;
- gs_free char *formatted_bytes_transferred =
+ g_autofree char *formatted_bytes_transferred =
g_format_size_full (bytes_transferred, 0);
- gs_free char *formatted_bytes_sec = NULL;
+ g_autofree char *formatted_bytes_sec = NULL;
if (!bytes_sec) // Ignore first second
formatted_bytes_sec = g_strdup ("-");
if (total_delta_parts > 0)
{
guint64 total_delta_part_size = ostree_async_progress_get_uint64 (progress, "total-delta-part-size");
- gs_free char *formatted_total =
+ g_autofree char *formatted_total =
g_format_size (total_delta_part_size);
g_string_append_printf (buf, "Receiving delta parts: %u/%u %s/s %s/%s",
fetched_delta_parts, total_delta_parts,
gs_unref_bytes GBytes *delta_data = NULL;
gs_unref_bytes GBytes *signature_data = NULL;
gs_unref_variant GVariant *commit_variant = NULL;
- gs_free char *delta_path = NULL;
+ g_autofree char *delta_path = NULL;
gs_unref_object GFile *delta_file = NULL;
- gs_free char *detached_metadata_relpath = NULL;
+ g_autofree char *detached_metadata_relpath = NULL;
gs_unref_object GFile *detached_metadata_path = NULL;
gs_unref_variant GVariant *existing_detached_metadata = NULL;
gs_unref_variant GVariant *normalized = NULL;
gs_unref_object GFile *keyringdir_ref = NULL;
gs_unref_variant GVariant *metadata = NULL;
gs_unref_bytes GBytes *signed_data = NULL;
- gs_free gchar *commit_filename = NULL;
+ g_autofree char *commit_filename = NULL;
/* Create a temporary file for the commit */
if (!ostree_repo_load_variant (self, OSTREE_OBJECT_TYPE_COMMIT,
{
gsize len;
GError *temp_error = NULL;
- gs_free char *line = g_data_input_stream_read_line_utf8 (datain, &len,
+ g_autofree char *line = g_data_input_stream_read_line_utf8 (datain, &len,
cancellable, &temp_error);
if (temp_error)
#ifdef HAVE_SELINUX
gboolean ret = FALSE;
gs_unref_object GFileInfo *src_info = NULL;
- gs_free char *label = NULL;
+ g_autofree char *label = NULL;
gboolean do_relabel = TRUE;
if (info != NULL)
{
#ifdef HAVE_SELINUX
gboolean ret = FALSE;
- gs_free char *label = NULL;
+ g_autofree char *label = NULL;
/* setfscreatecon() will bomb out if the host has SELinux disabled,
* but we're enabled for the target system. This is kind of a
GFileInfo *file_info = NULL;
GFile *child = NULL;
gs_unref_object OstreeDeployment *deployment = NULL;
- gs_free char *csum = NULL;
+ g_autofree char *csum = NULL;
gint deployserial;
if (!gs_file_enumerator_iterate (dir_enum, &file_info, &child,
for (i = 0; i < all_boot_dirs->len; i++)
{
GFile *bootdir = all_boot_dirs->pdata[i];
- gs_free char *osname = NULL;
- gs_free char *bootcsum = NULL;
+ g_autofree char *osname = NULL;
+ g_autofree char *bootcsum = NULL;
if (!parse_bootdir_name (gs_file_get_basename_cached (bootdir),
&osname, &bootcsum))
GError **error)
{
gboolean ret = FALSE;
- gs_free char *prefix = NULL;
+ g_autofree char *prefix = NULL;
gs_unref_hashtable GHashTable *refs = NULL;
GHashTableIter hashiter;
gpointer hashkey, hashvalue;
while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
{
const char *suffix = hashkey;
- gs_free char *ref = g_strconcat (prefix, "/", suffix, NULL);
+ g_autofree char *ref = g_strconcat (prefix, "/", suffix, NULL);
ostree_repo_transaction_set_refspec (repo, ref, NULL);
}
for (i = 0; i < deployments->len; i++)
{
OstreeDeployment *deployment = deployments->pdata[i];
- gs_free char *refname = g_strdup_printf ("ostree/%d/%d/%u",
+ g_autofree char *refname = g_strdup_printf ("ostree/%d/%d/%u",
bootversion, subbootversion,
i);
}
else if (errno == ENOENT)
{
- gs_free char *parent_path = g_path_get_dirname (path);
+ g_autofree char *parent_path = g_path_get_dirname (path);
if (strcmp (parent_path, ".") != 0)
{
if (strchr (path, '/') != NULL)
{
- gs_free char *parent = g_path_get_dirname (path);
+ g_autofree char *parent = g_path_get_dirname (path);
if (!ensure_directory_from_template (orig_etc_fd, modified_etc_fd, new_etc_fd,
parent, &dest_parent_dfd, cancellable, error))
{
GFile *file = removed->pdata[i];
gs_unref_object GFile *target_file = NULL;
- gs_free char *path = NULL;
+ g_autofree char *path = NULL;
path = g_file_get_relative_path (orig_etc, file);
g_assert (path);
for (i = 0; i < modified->len; i++)
{
OstreeDiffItem *diff = modified->pdata[i];
- gs_free char *path = g_file_get_relative_path (modified_etc, diff->target);
+ g_autofree char *path = g_file_get_relative_path (modified_etc, diff->target);
g_assert (path);
for (i = 0; i < added->len; i++)
{
GFile *file = added->pdata[i];
- gs_free char *path = g_file_get_relative_path (modified_etc, file);
+ g_autofree char *path = g_file_get_relative_path (modified_etc, file);
g_assert (path);
gboolean ret = FALSE;
OstreeRepoCheckoutOptions checkout_opts = { 0, };
const char *csum = ostree_deployment_get_csum (deployment);
- gs_free char *checkout_target_name = NULL;
+ g_autofree char *checkout_target_name = NULL;
g_autofree char *osdeploy_path = NULL;
gs_unref_object GFile *ret_deploy_target_path = NULL;
glnx_fd_close int osdeploy_dfd = -1;
GError **error)
{
gboolean ret = FALSE;
- gs_free char *relpath = NULL;
+ g_autofree char *relpath = NULL;
relpath = ptrarray_path_join (path_parts);
if (!ostree_sepolicy_restorecon (sepolicy, relpath,
gs_unref_object GFile *deployment_path = ostree_sysroot_get_deployment_directory (sysroot, deployment);
gs_unref_object GFile *origin_path = ostree_sysroot_get_deployment_origin_path (deployment_path);
gs_unref_object GFile *origin_parent = g_file_get_parent (origin_path);
- gs_free char *contents = NULL;
+ g_autofree char *contents = NULL;
gsize len;
gs_unref_bytes GBytes *contents_bytes = NULL;
gs_unref_object GFileEnumerator *dir_enum = NULL;
gs_unref_object GFile *ret_kernel = NULL;
gs_unref_object GFile *ret_initramfs = NULL;
- gs_free char *kernel_checksum = NULL;
- gs_free char *initramfs_checksum = NULL;
+ g_autofree char *kernel_checksum = NULL;
+ g_autofree char *initramfs_checksum = NULL;
if (g_file_query_exists (ostree_bootdir, NULL))
{
int old_subbootversion;
int new_subbootversion;
gs_unref_object GFile *ostree_dir = g_file_get_child (self->path, "ostree");
- gs_free char *ostree_bootdir_name = g_strdup_printf ("boot.%d", bootversion);
+ g_autofree char *ostree_bootdir_name = g_strdup_printf ("boot.%d", bootversion);
gs_unref_object GFile *ostree_bootdir = g_file_resolve_relative_path (ostree_dir, ostree_bootdir_name);
- gs_free char *ostree_subbootdir_name = NULL;
+ g_autofree char *ostree_subbootdir_name = NULL;
gs_unref_object GFile *ostree_subbootdir = NULL;
if (bootversion != self->bootversion)
for (i = 0; i < new_deployments->len; i++)
{
OstreeDeployment *deployment = new_deployments->pdata[i];
- gs_free char *bootlink_pathname = g_strdup_printf ("%s/%s/%d",
+ g_autofree char *bootlink_pathname = g_strdup_printf ("%s/%s/%d",
ostree_deployment_get_osname (deployment),
ostree_deployment_get_bootcsum (deployment),
ostree_deployment_get_bootserial (deployment));
- gs_free char *bootlink_target = g_strdup_printf ("../../../deploy/%s/deploy/%s.%d",
+ g_autofree char *bootlink_target = g_strdup_printf ("../../../deploy/%s/deploy/%s.%d",
ostree_deployment_get_osname (deployment),
ostree_deployment_get_csum (deployment),
ostree_deployment_get_deployserial (deployment));
gs_unref_object GFile *bootcsumdir = NULL;
gs_unref_object GFile *bootconfpath = NULL;
gs_unref_object GFile *bootconfpath_parent = NULL;
- gs_free char *dest_kernel_name = NULL;
+ g_autofree char *dest_kernel_name = NULL;
gs_unref_object GFile *dest_kernel_path = NULL;
gs_unref_object GFile *dest_initramfs_path = NULL;
gs_unref_object GFile *tree_kernel_path = NULL;
gs_unref_object GFile *tree_initramfs_path = NULL;
gs_unref_object GFile *deployment_dir = NULL;
glnx_fd_close int deployment_dfd = -1;
- gs_free char *contents = NULL;
- gs_free char *deployment_version = NULL;
+ g_autofree char *contents = NULL;
+ g_autofree char *deployment_version = NULL;
gs_unref_hashtable GHashTable *osrelease_values = NULL;
- gs_free char *linux_relpath = NULL;
- gs_free char *linux_key = NULL;
- gs_free char *initramfs_relpath = NULL;
- gs_free char *initrd_key = NULL;
- gs_free char *version_key = NULL;
- gs_free char *ostree_kernel_arg = NULL;
- gs_free char *options_key = NULL;
+ g_autofree char *linux_relpath = NULL;
+ g_autofree char *linux_key = NULL;
+ g_autofree char *initramfs_relpath = NULL;
+ g_autofree char *initrd_key = NULL;
+ g_autofree char *version_key = NULL;
+ g_autofree char *ostree_kernel_arg = NULL;
+ g_autofree char *options_key = NULL;
GString *title_key;
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
const char *val;
if (tree_initramfs_path)
{
- gs_free char *dest_initramfs_name = remove_checksum_from_kernel_name (gs_file_get_basename_cached (tree_initramfs_path),
+ g_autofree char *dest_initramfs_name = remove_checksum_from_kernel_name (gs_file_get_basename_cached (tree_initramfs_path),
bootcsum);
dest_initramfs_path = g_file_get_child (bootcsumdir, dest_initramfs_name);
{
gboolean ret = FALSE;
gs_unref_object GFile *boot_loader_link = NULL;
- gs_free char *new_target = NULL;
+ g_autofree char *new_target = NULL;
g_assert ((current_bootversion == 0 && new_bootversion == 1) ||
(current_bootversion == 1 && new_bootversion == 0));
const char *b_boot_options = ostree_bootconfig_parser_get (b_bootconfig, "options");
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *a_kargs = NULL;
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *b_kargs = NULL;
- gs_free char *a_boot_options_without_ostree = NULL;
- gs_free char *b_boot_options_without_ostree = NULL;
+ g_autofree char *a_boot_options_without_ostree = NULL;
+ g_autofree char *b_boot_options_without_ostree = NULL;
/* We checksum the kernel arguments *except* ostree= */
a_kargs = _ostree_kernel_args_from_string (a_boot_options);
gs_unref_object GFile *tree_initramfs_path = NULL;
glnx_fd_close int deployment_dfd = -1;
gs_unref_object OstreeSePolicy *sepolicy = NULL;
- gs_free char *new_bootcsum = NULL;
+ g_autofree char *new_bootcsum = NULL;
gs_unref_object OstreeBootconfigParser *bootconfig = NULL;
g_return_val_if_fail (osname != NULL || self->booted_deployment != NULL, FALSE);
if (override_kernel_argv)
{
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
- gs_free char *new_options = NULL;
+ g_autofree char *new_options = NULL;
kargs = _ostree_kernel_args_new ();
_ostree_kernel_args_append_argv (kargs, override_kernel_argv);
gs_unref_ptrarray GPtrArray *new_deployments = g_ptr_array_new_with_free_func (g_object_unref);
gs_unref_object OstreeDeployment *new_deployment = NULL;
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
- gs_free char *new_options = NULL;
+ g_autofree char *new_options = NULL;
OstreeBootconfigParser *new_bootconfig;
new_deployment = ostree_deployment_clone (deployment);
GError **error)
{
gboolean ret = FALSE;
- gs_free char *origin_refspec = NULL;
- gs_free char *unconfigured_state = NULL;
+ g_autofree char *origin_refspec = NULL;
+ g_autofree char *unconfigured_state = NULL;
if ((self->flags & OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED) == 0)
{
{
GDateTime *old_ts = g_date_time_new_from_unix_utc (ostree_commit_get_timestamp (old_commit));
GDateTime *new_ts = g_date_time_new_from_unix_utc (ostree_commit_get_timestamp (new_commit));
- gs_free char *old_ts_str = NULL;
- gs_free char *new_ts_str = NULL;
+ g_autofree char *old_ts_str = NULL;
+ g_autofree char *new_ts_str = NULL;
g_assert (old_ts);
g_assert (new_ts);
gs_unref_object OstreeRepo *repo = NULL;
char *refs_to_fetch[] = { self->origin_ref, NULL };
const char *from_revision = NULL;
- gs_free char *new_revision = NULL;
- gs_free char *origin_refspec = NULL;
+ g_autofree char *new_revision = NULL;
+ g_autofree char *origin_refspec = NULL;
if (!ostree_sysroot_get_repo (self->sysroot, &repo, cancellable, error))
goto out;
{
gboolean ret = FALSE;
__attribute__((cleanup(match_info_cleanup))) GMatchInfo *match = NULL;
- gs_free char *serial_str = NULL;
+ g_autofree char *serial_str = NULL;
static gsize regex_initialized;
static GRegex *regex;
{
gboolean ret = FALSE;
struct stat stbuf;
- gs_free char *ostree_bootdir_name = g_strdup_printf ("ostree/boot.%d", bootversion);
+ g_autofree char *ostree_bootdir_name = g_strdup_printf ("ostree/boot.%d", bootversion);
if (!ensure_sysroot_fd (self, error))
goto out;
}
else
{
- gs_free char *current_subbootdir_name = NULL;
+ g_autofree char *current_subbootdir_name = NULL;
current_subbootdir_name = glnx_readlinkat_malloc (self->sysroot_fd, ostree_bootdir_name,
cancellable, error);
g_autoptr(GKeyFile) ret_origin = NULL;
g_autofree char *origin_path = g_strconcat ("../", deployment_name, ".origin", NULL);
struct stat stbuf;
- gs_free char *origin_contents = NULL;
+ g_autofree char *origin_contents = NULL;
ret_origin = g_key_file_new ();
{
gboolean ret = FALSE;
__attribute__((cleanup(match_info_cleanup))) GMatchInfo *match = NULL;
- gs_free char *bootversion_str = NULL;
- gs_free char *treebootserial_str = NULL;
+ g_autofree char *bootversion_str = NULL;
+ g_autofree char *treebootserial_str = NULL;
static gsize regex_initialized;
static GRegex *regex;
int entry_boot_version;
int treebootserial = -1;
int deployserial = -1;
- gs_free char *osname = NULL;
- gs_free char *bootcsum = NULL;
- gs_free char *treecsum = NULL;
+ g_autofree char *osname = NULL;
+ g_autofree char *bootcsum = NULL;
+ g_autofree char *treecsum = NULL;
glnx_fd_close int deployment_dfd = -1;
const char *deploy_basename;
g_autofree char *treebootserial_target = NULL;
GError **error)
{
gboolean ret = FALSE;
- gs_free char *ostree_arg = NULL;
+ g_autofree char *ostree_arg = NULL;
gs_unref_object OstreeDeployment *deployment = NULL;
ostree_arg = get_ostree_kernel_arg_from_config (config);
{
gboolean ret = FALSE;
gs_unref_object GFile *proc_cmdline = g_file_new_for_path ("/proc/cmdline");
- gs_free char *contents = NULL;
+ g_autofree char *contents = NULL;
gsize len;
if (!g_file_load_contents (proc_cmdline, cancellable, &contents, &len, NULL,
{
gboolean ret = FALSE;
GChecksum *checksum = NULL;
- gs_free guchar *ret_csum = NULL;
+ g_autofree guchar *ret_csum = NULL;
checksum = g_checksum_new (G_CHECKSUM_SHA256);
/* A workaround for the lack of lgetxattrat(), thanks to Florian Weimer:
* https://mail.gnome.org/archives/ostree-list/2014-February/msg00017.html
*/
- gs_free char *full_path = g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path);
+ g_autofree char *full_path = g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path);
GBytes *bytes = NULL;
ssize_t bytes_read, real_size;
char *buf;
/* A workaround for the lack of lsetxattrat(), thanks to Florian Weimer:
* https://mail.gnome.org/archives/ostree-list/2014-February/msg00017.html
*/
- gs_free char *full_path = g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path);
+ g_autofree char *full_path = g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path);
int res;
do
{
va_list args;
const char *arg;
- gs_free char *path = NULL;
+ g_autofree char *path = NULL;
gs_unref_ptrarray GPtrArray *components = NULL;
va_start (args, first);
{
va_list args;
const char *arg;
- gs_free char *path = NULL;
+ g_autofree char *path = NULL;
gs_unref_ptrarray GPtrArray *components = NULL;
va_start (args, first);
...)
{
va_list args;
- gs_free char *relpath = NULL;
+ g_autofree char *relpath = NULL;
va_start (args, format);
relpath = g_strdup_vprintf (format, args);
{
gboolean ret = FALSE;
GError *temp_error = NULL;
- gs_free char *ret_contents = NULL;
+ g_autofree char *ret_contents = NULL;
ret_contents = gs_file_load_contents_utf8 (path, cancellable, &temp_error);
if (!ret_contents)
{
gboolean ret = FALSE;
int fd;
- gs_free char *tmpname = NULL;
+ g_autofree char *tmpname = NULL;
gs_unref_object GOutputStream *stream = NULL;
gs_unref_object GInputStream *instream = NULL;
{
gboolean ret = FALSE;
gs_unref_object GFile *parent = g_file_get_parent (path);
- gs_free char *tmpname = g_strconcat (gs_file_get_basename_cached (path), ".tmp", NULL);
+ g_autofree char *tmpname = g_strconcat (gs_file_get_basename_cached (path), ".tmp", NULL);
gs_unref_object GFile *tmppath = g_file_get_child (parent, tmpname);
int parent_dfd = -1;
{
gboolean ret = FALSE;
GError *temp_error = NULL;
- gs_free char *ret_value = NULL;
+ g_autofree char *ret_value = NULL;
g_return_val_if_fail (keyfile != NULL, ret);
g_return_val_if_fail (section != NULL, ret);
for (ii = 0; ii < length; ii++)
{
- gs_free char *value = NULL;
+ g_autofree char *value = NULL;
value = g_key_file_get_value (source_keyfile, group_name, keys[ii], NULL);
g_key_file_set_value (target_keyfile, group_name, keys[ii], value);
gs_unref_ptrarray GPtrArray *new_deployments = NULL;
gs_unref_object OstreeDeployment *new_deployment = NULL;
gs_unref_object OstreeDeployment *merge_deployment = NULL;
- gs_free char *revision = NULL;
+ g_autofree char *revision = NULL;
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
context = g_option_context_new ("REFSPEC - Checkout revision REFSPEC as the new default deployment");
gboolean ret = FALSE;
OstreeAdminInstUtilCommand *subcommand;
const char *subcommand_name = NULL;
- gs_free char *prgname = NULL;
+ g_autofree char *prgname = NULL;
int in, out;
for (in = 1, out = 1; in < argc; in++, out++)
if (!subcommand->name)
{
GOptionContext *context;
- gs_free char *help;
+ g_autofree char *help;
context = ostree_admin_instutil_option_context_new_with_commands ();
for (iter = opt_set; iter && *iter; iter++)
{
const char *keyvalue = *iter;
- gs_free char *subkey = NULL;
- gs_free char *subvalue = NULL;
+ g_autofree char *subkey = NULL;
+ g_autofree char *subvalue = NULL;
if (!ot_parse_keyvalue (keyvalue, &subkey, &subvalue, error))
goto out;
}
{ GKeyFile *old_origin = ostree_deployment_get_origin (target_deployment);
- gs_free char *origin_refspec = g_key_file_get_string (old_origin, "origin", "refspec", NULL);
- gs_free char *new_refspec = NULL;
- gs_free char *origin_remote = NULL;
- gs_free char *origin_ref = NULL;
+ g_autofree char *origin_refspec = g_key_file_get_string (old_origin, "origin", "refspec", NULL);
+ g_autofree char *new_refspec = NULL;
+ g_autofree char *origin_remote = NULL;
+ g_autofree char *origin_ref = NULL;
if (!ostree_parse_refspec (origin_refspec, &origin_remote, &origin_ref, error))
goto out;
- { gs_free char *new_refspec = g_strconcat (remotename, ":", branch ? branch : origin_ref, NULL);
+ { g_autofree char *new_refspec = g_strconcat (remotename, ":", branch ? branch : origin_ref, NULL);
gs_unref_keyfile GKeyFile *new_origin = NULL;
gs_unref_object GFile *origin_path = NULL;
* API in libostree if the OstreeRepo parameter is acceptable. */
GKeyFile *origin;
- gs_free char *refspec = NULL;
- gs_free char *remote = NULL;
+ g_autofree char *refspec = NULL;
+ g_autofree char *remote = NULL;
gboolean gpg_verify = FALSE;
origin = ostree_deployment_get_origin (deployment);
OstreeDeployment *deployment = deployments->pdata[i];
GKeyFile *origin;
const char *ref = ostree_deployment_get_csum (deployment);
- gs_free gchar *version = version_of_commit (repo, ref);
+ g_autofree char *version = version_of_commit (repo, ref);
gs_unref_object OstreeGpgVerifyResult *result = NULL;
GString *output_buffer;
guint jj, n_signatures;
g_print (" origin: none\n");
else
{
- gs_free char *origin_refspec = g_key_file_get_string (origin, "origin", "refspec", NULL);
+ g_autofree char *origin_refspec = g_key_file_get_string (origin, "origin", "refspec", NULL);
if (!origin_refspec)
g_print (" origin: <unknown origin type>\n");
else
gs_unref_object OstreeSysroot *sysroot = NULL;
const char *new_provided_refspec = NULL;
gs_unref_object OstreeRepo *repo = NULL;
- gs_free char *origin_refspec = NULL;
- gs_free char *origin_remote = NULL;
- gs_free char *origin_ref = NULL;
- gs_free char *new_remote = NULL;
- gs_free char *new_ref = NULL;
- gs_free char *new_refspec = NULL;
- gs_free char *new_revision = NULL;
+ g_autofree char *origin_refspec = NULL;
+ g_autofree char *origin_remote = NULL;
+ g_autofree char *origin_ref = NULL;
+ g_autofree char *new_remote = NULL;
+ g_autofree char *new_ref = NULL;
+ g_autofree char *new_refspec = NULL;
+ g_autofree char *new_revision = NULL;
gs_unref_object GFile *deployment_path = NULL;
gs_unref_object GFile *deployment_origin_path = NULL;
gs_unref_object OstreeDeployment *merge_deployment = NULL;
GOptionContext *context;
gs_unref_object OstreeSysroot *sysroot = NULL;
gs_unref_object OstreeSysrootUpgrader *upgrader = NULL;
- gs_free char *origin_remote = NULL;
- gs_free char *origin_ref = NULL;
- gs_free char *origin_refspec = NULL;
- gs_free char *new_revision = NULL;
+ g_autofree char *origin_remote = NULL;
+ g_autofree char *origin_ref = NULL;
+ g_autofree char *origin_refspec = NULL;
+ g_autofree char *new_revision = NULL;
gs_unref_object GFile *deployment_path = NULL;
gs_unref_object GFile *deployment_origin_path = NULL;
gs_unref_object OstreeDeployment *merge_deployment = NULL;
GError **error)
{
gboolean ret = FALSE;
- gs_free char *relpath = NULL;
- gs_free char *new_label = NULL;
+ g_autofree char *relpath = NULL;
+ g_autofree char *new_label = NULL;
relpath = ptrarray_path_join (path_parts);
if (!ostree_sepolicy_restorecon (sepolicy, relpath,
gboolean ret = FALSE;
const char *subcommand_name = NULL;
OstreeAdminCommand *subcommand;
- gs_free char *prgname = NULL;
+ g_autofree char *prgname = NULL;
int in, out;
/*
if (!subcommand->name)
{
GOptionContext *context;
- gs_free char *help;
+ g_autofree char *help;
context = ostree_admin_option_context_new_with_commands ();
GError *temp_error = NULL;
gs_unref_object GInputStream *instream = NULL;
gs_unref_object GDataInputStream *datastream = NULL;
- gs_free char *revision = NULL;
- gs_free char *subpath = NULL;
- gs_free char *resolved_commit = NULL;
+ g_autofree char *revision = NULL;
+ g_autofree char *subpath = NULL;
+ g_autofree char *resolved_commit = NULL;
if (opt_from_stdin)
{
gboolean ret = FALSE;
const char *commit;
const char *destination;
- gs_free char *resolved_commit = NULL;
+ g_autofree char *resolved_commit = NULL;
context = g_option_context_new ("COMMIT [DESTINATION] - Check out a commit into a filesystem tree");
GAsyncResult *result,
gpointer user_data)
{
- gs_free guchar *csum = NULL;
- gs_free char *checksum = NULL;
+ g_autofree guchar *csum = NULL;
+ g_autofree char *checksum = NULL;
AsyncChecksumData *data = user_data;
if (ostree_checksum_file_async_finish ((GFile*)obj, result, &csum, data->error))
char **iter = NULL; /* nofree */
gs_unref_hashtable GHashTable *ret_hash = NULL;
gs_unref_object GFile *path = NULL;
- gs_free char *contents = NULL;
+ g_autofree char *contents = NULL;
char **lines = NULL;
path = g_file_new_for_path (opt_statoverride_file);
GCancellable *cancellable,
GError **error)
{
- gs_free char *input = NULL;
- gs_free char *output = NULL;
+ g_autofree char *input = NULL;
+ g_autofree char *output = NULL;
gboolean ret = FALSE;
GString *bodybuf = NULL;
char **lines = NULL;
{
const char *s;
const char *eq;
- gs_free char *key = NULL;
+ g_autofree char *key = NULL;
s = *iter;
gboolean ret = FALSE;
gboolean skip_commit = FALSE;
gs_unref_object GFile *arg = NULL;
- gs_free char *parent = NULL;
- gs_free char *commit_checksum = NULL;
+ g_autofree char *parent = NULL;
+ g_autofree char *commit_checksum = NULL;
gs_unref_object GFile *root = NULL;
gs_unref_variant GVariant *metadata = NULL;
gs_unref_variant GVariant *detached_metadata = NULL;
gs_unref_object OstreeMutableTree *mtree = NULL;
- gs_free char *tree_type = NULL;
+ g_autofree char *tree_type = NULL;
gs_unref_hashtable GHashTable *mode_adds = NULL;
OstreeRepoCommitModifierFlags flags = 0;
OstreeRepoCommitModifier *modifier = NULL;
const char *op;
const char *section_key;
const char *value;
- gs_free char *section = NULL;
- gs_free char *key = NULL;
+ g_autofree char *section = NULL;
+ g_autofree char *key = NULL;
GKeyFile *config = NULL;
context = g_option_context_new ("- Change configuration settings");
else if (!strcmp (op, "get"))
{
GKeyFile *readonly_config = NULL;
- gs_free char *value = NULL;
+ g_autofree char *value = NULL;
if (argc < 3)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
gs_unref_object OstreeRepo *repo = NULL;
const char *src;
const char *target;
- gs_free char *src_prev = NULL;
+ g_autofree char *src_prev = NULL;
gs_unref_object GFile *srcf = NULL;
gs_unref_object GFile *targetf = NULL;
gs_unref_ptrarray GPtrArray *modified = NULL;
gs_unref_hashtable GHashTable *reachable_a = NULL;
gs_unref_hashtable GHashTable *reachable_b = NULL;
gs_unref_hashtable GHashTable *reachable_intersection = NULL;
- gs_free char *rev_a = NULL;
- gs_free char *rev_b = NULL;
- gs_free char *size = NULL;
+ g_autofree char *rev_a = NULL;
+ g_autofree char *rev_b = NULL;
+ g_autofree char *size = NULL;
guint a_size;
guint b_size;
guint64 total_common;
}
else
{
- gs_free guchar *computed_csum = NULL;
- gs_free char *tmp_checksum = NULL;
+ g_autofree guchar *computed_csum = NULL;
+ g_autofree char *tmp_checksum = NULL;
if (!ostree_checksum_file_from_input (file_info, xattrs, input,
objtype, &computed_csum,
tmp_checksum = ostree_checksum_from_bytes (computed_csum);
if (strcmp (checksum, tmp_checksum) != 0)
{
- gs_free char *msg = g_strdup_printf ("corrupted object %s.%s; actual checksum: %s",
+ g_autofree char *msg = g_strdup_printf ("corrupted object %s.%s; actual checksum: %s",
checksum, ostree_object_type_to_string (objtype),
tmp_checksum);
if (opt_delete)
static void
usage_error (GOptionContext *context, const char *message, GError **error)
{
- gs_free char *help = g_option_context_get_help (context, TRUE, NULL);
+ g_autofree char *help = g_option_context_get_help (context, TRUE, NULL);
g_printerr ("%s", help);
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, message);
}
{
GOptionContext *context;
gs_unref_object OstreeRepo *repo = NULL;
- gs_free char *resolved_commit = NULL;
+ g_autofree char *resolved_commit = NULL;
const char *commit;
char **key_ids;
int n_key_ids, ii;
GError **error)
{
gs_unref_variant GVariant *variant = NULL;
- gs_free gchar *parent = NULL;
+ g_autofree char *parent = NULL;
gboolean ret = FALSE;
GError *local_error = NULL;
gs_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
const char *rev;
- gs_free char *checksum = NULL;
+ g_autofree char *checksum = NULL;
OstreeDumpFlags flags = OSTREE_DUMP_NONE;
context = g_option_context_new ("REF - Show log starting at commit or ref");
gboolean ret = FALSE;
GOptionContext *context;
gs_unref_object OstreeRepo *repo = NULL;
- gs_free char *formatted_freed_size = NULL;
+ g_autofree char *formatted_freed_size = NULL;
OstreeRepoPruneFlags pruneflags = 0;
gint n_objects_total;
gint n_objects_pruned;
int i;
const char *src_repo_arg;
GSConsole *console = NULL;
- gs_free char *src_repo_uri = NULL;
+ g_autofree char *src_repo_uri = NULL;
gs_unref_object OstreeAsyncProgress *progress = NULL;
gs_unref_ptrarray GPtrArray *refs_to_fetch = NULL;
gs_unref_hashtable GHashTable *source_objects = NULL;
src_repo_uri = g_strconcat ("file://", src_repo_arg, NULL);
else
{
- gs_free char *cwd = g_get_current_dir ();
+ g_autofree char *cwd = g_get_current_dir ();
src_repo_uri = g_strconcat ("file://", cwd, "/", src_repo_arg, NULL);
}
GOptionContext *context;
gs_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
- gs_free char *remote = NULL;
+ g_autofree char *remote = NULL;
OstreeRepoPullFlags pullflags = 0;
GSConsole *console = NULL;
gs_unref_ptrarray GPtrArray *refs_to_fetch = NULL;
while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
{
const char *refspec = hashkey;
- gs_free char *remote = NULL;
- gs_free char *ref = NULL;
+ g_autofree char *remote = NULL;
+ g_autofree char *ref = NULL;
if (!ostree_parse_refspec (refspec, &remote, &ref, error))
goto out;
gboolean ret = FALSE;
const char *ref;
const char *target = NULL;
- gs_free gchar *current = NULL;
- gs_free gchar *checksum = NULL;
+ g_autofree char *current = NULL;
+ g_autofree char *checksum = NULL;
context = g_option_context_new ("REF COMMIT - Reset a REF to a previous COMMIT");
gboolean ret = FALSE;
const char *rev = "master";
int i;
- gs_free char *resolved_rev = NULL;
+ g_autofree char *resolved_rev = NULL;
context = g_option_context_new ("REV - Output the target of a rev");
while (g_variant_iter_loop (viter, "(&s@ay)", &name, &csum_v))
{
- gs_free char *checksum = ostree_checksum_from_bytes_v (csum_v);
+ g_autofree char *checksum = ostree_checksum_from_bytes_v (csum_v);
g_print ("%s %s\n", name, checksum);
}
csum_v = NULL;
gs_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
const char *rev;
- gs_free char *resolved_rev = NULL;
+ g_autofree char *resolved_rev = NULL;
context = g_option_context_new ("OBJECT - Output a metadata object");
g_print ("Extended Attributes: ");
if (xattrs)
{
- gs_free char *xattr_string = g_variant_print (xattrs, TRUE);
+ g_autofree char *xattr_string = g_variant_print (xattrs, TRUE);
g_print ("{ %s }\n", xattr_string);
}
else
else
{
const char *from_source;
- gs_free char *from_resolved = NULL;
- gs_free char *to_resolved = NULL;
- gs_free char *from_parent_str = NULL;
+ g_autofree char *from_resolved = NULL;
+ g_autofree char *to_resolved = NULL;
+ g_autofree char *from_parent_str = NULL;
gs_unref_variant_builder GVariantBuilder *parambuilder = NULL;
g_assert (opt_to_rev);
if (!command->fn)
{
- gs_free char *msg = g_strdup_printf ("Unknown command '%s'", cmdname);
+ g_autofree char *msg = g_strdup_printf ("Unknown command '%s'", cmdname);
static_delta_usage (argv, TRUE);
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, msg);
goto out;
char *slash;
int ret;
struct stat stbuf;
- gs_free char *safepath = NULL;
+ g_autofree char *safepath = NULL;
if (strstr (path, "../") != NULL)
{
slash = strrchr (safepath, '/');
if (!slash || slash[1])
{
- gs_free char *redir_uri = NULL;
+ g_autofree char *redir_uri = NULL;
redir_uri = g_strdup_printf ("%s/", soup_message_get_uri (msg)->path);
soup_message_set_redirect (msg, SOUP_STATUS_MOVED_PERMANENTLY,
}
else
{
- gs_free char *index_realpath = g_strconcat (safepath, "/index.html", NULL);
+ g_autofree char *index_realpath = g_strconcat (safepath, "/index.html", NULL);
if (stat (index_realpath, &stbuf) != -1)
{
- gs_free char *index_path = g_strconcat (path, "/index.html", NULL);
+ g_autofree char *index_path = g_strconcat (path, "/index.html", NULL);
do_get (self, server, msg, index_path, context);
}
else
}
else /* msg->method == SOUP_METHOD_HEAD */
{
- gs_free char *length = NULL;
+ g_autofree char *length = NULL;
/* We could just use the same code for both GET and
* HEAD (soup-message-server-io.c will fix things up).
soup_server_add_handler (server, NULL, httpd_callback, app, NULL);
if (opt_port_file)
{
- gs_free char *portstr = NULL;
+ g_autofree char *portstr = NULL;
#if SOUP_CHECK_VERSION(2, 48, 0)
GSList *listeners = soup_server_get_listeners (server);
gs_unref_object GSocket *listener = NULL;
void
ot_dump_variant (GVariant *variant)
{
- gs_free char *formatted_variant = NULL;
+ g_autofree char *formatted_variant = NULL;
gs_unref_variant GVariant *byteswapped = NULL;
if (G_BYTE_ORDER != G_BIG_ENDIAN)
const gchar *subject;
const gchar *body;
guint64 timestamp;
- gs_free gchar *str = NULL;
- gs_free gchar *version = NULL;
+ g_autofree char *str = NULL;
+ g_autofree char *version = NULL;
/* See OSTREE_COMMIT_GVARIANT_FORMAT */
g_variant_get (variant, "(a{sv}aya(say)&s&stayay)", NULL, NULL, NULL,
GOutputStream *output;
const char *editor;
char *ret = NULL;
- gs_free gchar *args = NULL;
+ g_autofree char *args = NULL;
editor = get_editor ();
if (editor == NULL)
goto out;
{
- gs_free gchar *quoted_file = g_shell_quote (gs_file_get_path_cached (file));
+ g_autofree char *quoted_file = g_shell_quote (gs_file_get_path_cached (file));
args = g_strconcat (editor, " ", quoted_file, NULL);
}
ctx = gs_subprocess_context_newv ("/bin/sh", "-c", args, NULL);
gboolean is_error)
{
GOptionContext *context;
- gs_free char *help;
+ g_autofree char *help;
context = ostree_option_context_new_with_commands (commands);
GError *error = NULL;
GCancellable *cancellable = NULL;
const char *command_name = NULL;
- gs_free char *prgname = NULL;
+ g_autofree char *prgname = NULL;
gboolean success = FALSE;
int in, out;
if (!command->fn)
{
GOptionContext *context;
- gs_free char *help;
+ g_autofree char *help;
context = ostree_option_context_new_with_commands (commands);
{
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
{
- gs_free char *help = NULL;
+ g_autofree char *help = NULL;
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Command requires a --repo argument");
gs_unref_ptrarray GPtrArray *deployments = NULL;
OstreeDeployment *first_deployment;
gs_unref_object GFile *deployment_file = NULL;
- gs_free char *deployment_path = NULL;
+ g_autofree char *deployment_path = NULL;
if (!ostree_sysroot_load (sysroot, cancellable, error))
goto out;
struct bsdiff_stream bsdiff_stream;
struct bspatch_stream bspatch_stream;
int i;
- gs_free guint8 *old = g_new (guint8, OLD_SIZE);
- gs_free guint8 *new = g_new (guint8, NEW_SIZE);
- gs_free guint8 *new_generated = g_new0 (guint8, NEW_SIZE);
+ g_autofree guint8 *old = g_new (guint8, OLD_SIZE);
+ g_autofree guint8 *new = g_new (guint8, NEW_SIZE);
+ g_autofree guint8 *new_generated = g_new0 (guint8, NEW_SIZE);
gs_unref_object GOutputStream *out = g_memory_output_stream_new_resizable ();
gs_unref_object GInputStream *in = NULL;
gpgme_data_t data_buffer;
gpgme_data_t signature_buffer;
OstreeGpgVerifyResult *result;
- gs_free char *homedir = NULL;
- gs_free char *filename = NULL;
+ g_autofree char *homedir = NULL;
+ g_autofree char *filename = NULL;
GError *local_error = NULL;
/* Mimic what OstreeGpgVerifier does to create OstreeGpgVerifyResult.
for (ii = 0; ii < length; ii++)
{
- gs_free char *value = NULL;
- gs_free char *value2 = NULL;
+ g_autofree char *value = NULL;
+ g_autofree char *value2 = NULL;
value = g_key_file_get_value (g_keyfile, section, keys[ii], NULL);
value2 = g_key_file_get_value (g_keyfile, section, keys[ii], NULL);
{
gs_unref_object OstreeMutableTree *subdir = NULL;
gs_unref_object OstreeMutableTree *a = NULL;
- gs_free char *source_checksum = NULL;
+ g_autofree char *source_checksum = NULL;
ostree_mutable_tree_lookup (tree, "a", &source_checksum, &a, &error);
g_assert (ostree_mutable_tree_walk (a, split_path, 1, &subdir, &error));
g_assert (subdir);
GError *error = NULL;
const char *pathname = "/foo/bar/baz";
const char *checksum = "01234567890123456789012345678901";
- gs_free char *source_checksum = NULL;
+ g_autofree char *source_checksum = NULL;
gs_unref_object OstreeMutableTree *source_subdir = NULL;
- gs_free char *source_checksum2 = NULL;
+ g_autofree char *source_checksum2 = NULL;
gs_unref_object OstreeMutableTree *source_subdir2 = NULL;
g_assert (ot_util_path_split_validate (pathname, &split_path, &error));
const char *dirname = "foo";
const char *filename = "bar";
const char *checksum = "01234567890123456789012345678901";
- gs_free char *source_checksum = NULL;
+ g_autofree char *source_checksum = NULL;
gs_unref_object OstreeMutableTree *source_subdir = NULL;
g_assert (ostree_mutable_tree_ensure_dir (tree, dirname, &parent, &error));
g_assert (ostree_mutable_tree_replace_file (tree, filename, checksum, &error));
{
- gs_free char *out_checksum = NULL;
+ g_autofree char *out_checksum = NULL;
gs_unref_object OstreeMutableTree *subdir = NULL;
g_assert (ostree_mutable_tree_lookup (tree, filename, &out_checksum, &subdir, &error));
g_assert_cmpstr (checksum, ==, out_checksum);
g_assert (ostree_mutable_tree_replace_file (tree, filename, checksum2, &error));
{
- gs_free char *out_checksum = NULL;
+ g_autofree char *out_checksum = NULL;
gs_unref_object OstreeMutableTree *subdir = NULL;
g_assert (ostree_mutable_tree_lookup (tree, filename, &out_checksum, &subdir, &error));
g_assert_cmpstr (checksum2, ==, out_checksum);
for (i = 0; i < G_N_ELEMENTS (keyvalue); i++)
{
- gs_free char *out_key = NULL;
- gs_free char *out_value = NULL;
+ g_autofree char *out_key = NULL;
+ g_autofree char *out_value = NULL;
g_assert_true (ot_parse_keyvalue (keyvalue[i],
&out_key,
&out_value,
}
{
- gs_free char *out_key = NULL;
- gs_free char *out_value = NULL;
+ g_autofree char *out_key = NULL;
+ g_autofree char *out_value = NULL;
g_assert_false (ot_parse_keyvalue ("blabla",
&out_key,
&out_value,
if (g_test_verbose ())
{
gs_unref_variant GVariant *v = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), buf->str, buf->len, TRUE, NULL, NULL);
- gs_free char *data = g_variant_print (v, FALSE);
+ g_autofree char *data = g_variant_print (v, FALSE);
g_test_message ("%" G_GUINT64_FORMAT " -> %s", val, data);
}
g_assert (_ostree_read_varuint64 ((guint8*)buf->str, buf->len, &newval, &bytes_read));